package com.zoranjoka.chordis.pages;

import java.util.List;

import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.hibernate.annotations.CommitAfter;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.zoranjoka.chordis.dao.AlbumDAO;


public class Album {

	@Inject
	private AlbumDAO dataAlbum;
	@Property
	private com.zoranjoka.chordis.entities.Album a;
	@Property
	private List<com.zoranjoka.chordis.entities.Album> albums;
	
	void onActivate()
	{
		albums = dataAlbum.getAll();
	}
	
	@OnEvent(component="deleteAlbum")
	@CommitAfter
	void deleteAlbum(long id)
	{
		a = dataAlbum.findById(id);
		
		dataAlbum.delete(a);
	}
}
